#include "DbFeed.h"
#include "Query.h"
#include "FreshNet.h"

DbFeed::DbFeed(Database& db, Query& row) 
{
    setTitle(row.get_str());
    setAuthor(row.get_str());
    setDescription(row.get_str());
    setFeedUrl(row.get_str());
    setPageUrl(row.get_str());
    
    Query q(db);
    string query("SELECT * FROM [Posts] WHERE feedUrl = '");
    query.append(tosql(feedUrl)).append("'");
   
    q.get_result(query);

    while(q.fetch_row())
    {
        Post post;
        post.link = q.get_str();
        q.get_str();//pass over this        
        post.title = q.get_str();
        post.author = q.get_str();
        post.description = q.get_str();
        post.content = q.get_str();
        posts.push_back(post);
    }
}

DbFeed::~DbFeed()
{
}
